import time

def buble(massiv,N):
    for i in range(N-1):
        for j in range(N-i-1):
            if massiv[j]>massiv[j+1]:
                massiv[j], massiv[j+1]=massiv[j+1], massiv[j]

def read(namefile):
    file=open(namefile,'r')
    data=file.readlines()
    return data

m1=read("m1_sorted.txt")
razmer=len(m1)
time_start=time.time()
buble(m1,razmer)
time_finish=time.time()
print("m1_sorted",round((time_finish-time_start)*1000),"milliseconds")

m2=read("m2_reverse.txt")
razmer=len(m2)
time_start=time.time()
buble(m2,razmer)
time_finish=time.time()
print("m2_reverse",round((time_finish-time_start)*1000),"milliseconds")

m3=read("m3_shuffle.txt")
razmer=len(m3)
time_start=time.time()
buble(m3,razmer)
time_finish=time.time()
print("m3_shuffle",round((time_finish-time_start)*1000),"milliseconds")
